<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 200px;
            height: 200px;
            background-color: aqua;
            display: none;
        }
    </style>
</head>
<body>
    <button class="button">显示</button>
    <div class="div"><button>隐藏</button></div>
    <script>
        let but1=document.querySelector(".button");
        let but2=document.querySelector(".div button");
        let div=document.querySelector(".div");
        but1.addEventListener("click",function(){
            div.style.display="block";
        })
        but2.addEventListener("click",function(e){
            div.style.display="none";
            div.style.backgroundColor="aqua";
            e.stopPropagation();
        })
        div.addEventListener("click",function(e){
            div.style.backgroundColor="red";
        })
    </script>
</body>
</html>